def _main():
    try:
        heads_count = int(input("请输入总头数："))
        feet_count = int(input("请输入总脚数："))
    except ValueError:
        print("输入有误，请检查。")
        return

    if heads_count < 0:
        print("总头数不能小于零。")
        return
    if feet_count < 0:
        print("总脚数不能小于零。")
        return
    if feet_count % 2 == 1:
        print("总脚数不能为奇数。")
        return

    chickens_count = 2 * heads_count - feet_count // 2
    if chickens_count < 0:
        print("就算全是兔子也做不到那么多脚。")
        return

    rabbits_count = feet_count // 2 - heads_count
    if rabbits_count < 0:
        print("就算全是鸡也做不到那么多头。")
        return

    print(f"{chickens_count} 只鸡和 {rabbits_count} 只兔子就会拥有 {heads_count} 个头和 {feet_count} 只脚。")


if __name__ == "__main__":
    _main()
